package com.it.park.rms.service.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.it.park.rms.client.model.User;
import com.it.park.rms.client.service.UserService;
import com.it.park.rms.dao.UserMapper;
import com.it.park.rms.service.impl.base.BaseServiceImpl;

@Service("userService")
public class UserServiceImpl extends BaseServiceImpl<User> implements UserService {
	
	@Autowired
	private UserMapper userMapper;

	@Override
	public boolean insert(User user) {
		return userMapper.insert(user) == 1;
	}
	
	@Override
	public User login(String username) {
		return userMapper.login(username);
	}
	@Override
	public boolean updatePwd(User user) {
		return userMapper.updatePwd(user)==1;
	}
	@Override
	public User selectCheckField(HashMap<String, Object> map) {
		return userMapper.selectCheckField(map);
	}
	@Override
	public boolean deleteByPrimaryKey(Integer id) {
		return userMapper.deleteByPrimaryKey(id)==1;
	}
	@Override
	public boolean insertSelective(User record) {
		return userMapper.insertSelective(record)==1;
	}
	@Override
	public User selectByPrimaryKey(Integer id) {
		return userMapper.selectByPrimaryKey(id);
	}
	@Override
	public boolean updateByPrimaryKeySelective(User record) {
		return userMapper.updateByPrimaryKeySelective(record)==1;
	}
	@Override
	public boolean updateByPrimaryKey(User record) {
		return userMapper.updateByPrimaryKey(record)==1;
	}
	@Override
	public List<User> selectAll() {
		return userMapper.selectAll();
	}
	
	@Override
	public  List<User> selectLatestRegister() {
		return userMapper.selectLatestRegister();
	}
	@Override
	public boolean updateAccountStatus(String id) {
		return userMapper.updateAccountStatus(id)==1;
	}
	@Override
	public  User selectByEmail(String email){
		return userMapper.selectByEmail(email);
	}
	@Override
	public List<User> selectIntegralRanking() {
		return userMapper.selectIntegralRanking();
	}
	@Override
	public boolean updateByPrimaryKeyWithBLOBs(User record) {
		return userMapper.updateByPrimaryKeyWithBLOBs(record)==1;
	}
	@Override
	public List<User> selectPagination(User t) {
		return userMapper.selectPagination(t);
	}
	@Override
	public Integer selectTotal(User t) {
		return userMapper.selectTotal(t);
	}

	@Override
	public void updateUserIntegral(User user) {
		userMapper.updateUserIntegral(user);
	}

	@Override
	public boolean batchUpdate(List<User> records) {
		return this.userMapper.batchUpdate(records) > 0;
	}

	

}
